#include "SDL.h"
#include "SDL_draw.h"

namespace DRAWING {
	
	struct Range {
		int x1, y1, x2, y2;
	};

	

	/**
	help draw line in cartesian coordinates(from lower left instead of upper left)
	**/
	void drawLine(SDL_Surface *screen, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2) {
		Uint32 c_white = SDL_MapRGB(screen->format, 255,255,255);
		
		Draw_Line(screen, x1, screen->h -1 - y1, x2, screen->h - 1 - y2, c_white);
		
	}

	void drawLine(SDL_Surface *screen,const Range& r, Uint32& color ) {
		
		Draw_Line(screen, r.x1, screen->h -1 - r.y1, r.x2, screen->h - 1 - r.y2, color);
	}


	void drawLine(SDL_Surface *screen,const Range& r ) {
		Uint32 c_white = SDL_MapRGB(screen->format, 255,255,255);
		drawLine(screen, r, c_white);
	}

	void drawCircle(SDL_Surface *screen, int x, int y, int radius ) {
		Uint32 red = SDL_MapRGB(screen->format, 255,0,0);
		Draw_Circle(screen, x,screen->h -1-y, radius, red);
	}

	void drawVector(SDL_Surface *screen,const Range& r, Uint32& color ) {
		//offset the endpoints
		Draw_Line(screen, r.x1, screen->h -1 - r.y1, r.x1 + r.x2, screen->h - 1 - r.y1 - r.y2, color);
	}

	void drawVector(SDL_Surface *screen,const Range& r ) {
		Uint32 c_white = SDL_MapRGB(screen->format, 255,255,255);
		drawVector(screen, r, c_white);
	}

}